$(function () {

  $(document).on('pageInit', '#page-index', function () {
    // 焦点图
    var focus = new Swiper ('.focus', {
      loop: true,
      pagination: '.swiper-pagination',
      autoplay: 5000,
      autoplayDisableOnInteraction: false
    });
    // 焦点图结束
    
    // gotoTop
    $(document).on('click', '.j-gotoTop', function (e) {
      $('.page-current .content').animate({
        scrollTop: 0
      });
    });

    $('.content').on('scroll', function (e) {
      if ($(this).scrollTop() > $(this).height()/2) {
        $('.j-gotoTop').addClass('active');
      }else {
        $('.j-gotoTop').removeClass('active');
      }
    });
    // /gotoTop
  });

  $.init();
  
});